<template>
  <baidu-map :center="center" :zoom="zoom" @ready="handler">
    <el-card>
      <el-form ref="form" :model="fileForm" label-width="100px">
        <el-form-item label="所在区">
          <el-input v-model="fileForm.county" size="mini" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="所在镇街">
          <el-select v-model="fileForm.twonStreet" placeholder="请选择所在镇街" size="mini" style="width:100%;" @change="streettwon">
            <el-option
              v-for="item in twonStreets"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="站点名称">
          <el-select v-model="fileForm.position" placeholder="请选择站点名称" size="mini" style="width:100%;" @change="positiontype">
            <el-option
              v-for="item in positions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="案卷站点类型">
          <el-select v-model="fileForm.stationType" placeholder="请选择案卷站点类型" size="mini" style="width:100%;">
            <el-option
              v-for="item in stationTypes"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="案卷设备编号">
          <el-input v-model="fileForm.MN" size="mini" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="案卷等级">
          <el-select v-model="fileForm.grade" placeholder="请选择案卷等级" size="mini" style="width:100%;">
            <el-option
              v-for="item in grades"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="上报时间">
          <el-date-picker
            v-model="fileForm.reportDate"
            type="datetime"
            size="mini"
            style="width:100%;"
            placeholder="选择日期时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="处理人">
          <el-select v-model="fileForm.handlePeople" placeholder="请选择案卷等级" size="mini" style="width:100%;" @change="handlepeople">
            <el-option
              v-for="(item, index) in handlePeoples"
              :key="index"
              :label="item.label"
              :value="item.value"
              :data-moble="item.moble">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="处理人电话">
          <el-input v-model="fileForm.phone" size="mini" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="案卷描述">
          <el-input v-model="fileForm.caseDesc" size="mini"></el-input>
        </el-form-item>
        <el-form-item label="案卷图片">
          <!-- <el-input v-model="fileForm.caseImage" size="mini"></el-input> -->
          <el-upload
            class="upload-demo"
            v-model="fileForm.file"
            action="http://61.181.255.77:17322/bc_hb/uploadDocument"
            multiple
            :on-success="fileSuccessImg"
            :before-upload="beforeUpload"
            :limit="3"
            id="upload"
            ref="upload"
            >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-form-item label="案卷视频">
          <!-- <el-input v-model="fileForm.caseVideo" size="mini"></el-input> -->
          <el-upload
            class="upload-demo"
            v-model="fileForm.file"
            action="http://61.181.255.77:17322/bc_hb/fileUpload"
            multiple
            :on-success="fileSuccessVideo"
            :limit="3"
            id="upload"
            ref="upload"
            >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="mini" @click="onSubmit">确定</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </baidu-map>
</template>
<script>
export default {
  data () {
    return {
      center: {lng: 0, lat: 0},
      zoom: 3
    }
  },
  methods: {
    handler ({BMap, map}) {
      console.log(BMap, map)
      this.center.lng = 116.404
      this.center.lat = 39.915
      this.zoom = 15
    }
  }
}
</script>